package managers;

import java.sql.*;

public class DatabaseConnection {


	private Connection connect = null;
	private Statement statement = null;
	private PreparedStatement preparedStatement = null;
	private ResultSet resultSet = null;

	public DatabaseConnection() throws Exception {
		
		try {
			Class.forName("com.mysql.jdbc.Driver");
			
			connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/PPKEA?zeroDateTimeBehavior=convertToNull", "root", "root");
			
		} catch(Exception e) {
			throw e;
		} finally {
			//close();
		}
	}
	
	private void close() {
		try {
			if(resultSet != null) {
				resultSet.close();
			}
			
			if(statement != null) {
				statement.close();	
			}
			
			if(connect != null) {
				connect.close();
			}
			
			} catch (Exception e) {
				
			}	
			
		}

	public Connection getConnect() {
		return connect;
	}
		
	}
